package com.woniuxy.configclient.controller;

import com.woniuxy.common.entity.Product;
import com.woniuxy.configclient.service.ProductService;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * @Author: 曾令忠
 * @Description:
 * @Date: 2020/7/10 0010-下午 5:41
 */
@RestController
public class ProductController {
    @Resource
    ProductService productService;
    @Value("${server.port}")
    String port;
    @RequestMapping("/all")
    public List<Product> all(){
        System.out.println(port);
        return productService.getAll();
    }
    @GetMapping("/hi/{name}")
    public String hi(@PathVariable("name") String name){
        return "hi "+name+",i am from port:"+port;
    }
}
